/*
*/
function getHTML(p_url){
	
	debug("Get code from "+p_url);
	
	try{
				
		var xml_envelope="<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:q0='http://analizer.thirtywords.com' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";
		xml_envelope+="<soapenv:Body>";
		xml_envelope+="<q0:analize>";
		xml_envelope+="<q0:url>"+p_url+"</q0:url>"; 
		xml_envelope+="</q0:analize>";
		xml_envelope+="</soapenv:Body>";
		xml_envelope+="</soapenv:Envelope>";
				
		$.ajax({
            type: "POST",
            timeout:60000,
            url: "http://localhost:8080/30words/services/Analyzer",
            contentType:"text/xml; charset='utf-8'",
            data:xml_envelope,
            dataType:'xml',
            beforeSend: function( xhr ){          
            	xhr.setRequestHeader(
            	"SOAPAction",
            	"analise"
            	);
            },
            success: function(response, result, xhr) {

        		var page = new Object();
        		page.url = p_url;
        		
            	var xml = $( response );
            	page.html=xml.find("analizeReturn").text();
            	debug("Web Service "+result);

            	analize_results(page);
            },
            error: function(response, status, xhr) {
            	debug("Web Service " +status+ " " + data.responseText);
            }
        });
			
	}catch(e){
		debug(e.description);
	}
}

function error(p_message){
	logger("Error",p_message,false);
}

function debug(p_message){
	logger("Debug",p_message,false);
}

function logger(p_level, p_message, p_verbose){

	if(p_verbose)
		alert("Verbose: "+p_message);
	
	var console = $("#console");
		
	console.html("");
	
	debugs[debugs.length]=p_level+": "+p_message;
		
	var i=0;
	var j=debugs.length-1;
		
	while(i<max_debugs && i<debugs.length){
		console.append(debugs[j]+"<br>");
		
		i++;
		j--;
	}
}

function showWait(){
	$("#wait").show();
}


function hideWait(){
	$("#wait").hide();
}